import entity.User;
import org.junit.Assert;
import org.junit.Test;

/**
 * @Version :测试
 * @PROJECT_NAME: java-basics
 * @PACKAGE_NAME:PACKAGE_NAME
 * @NAME: MyQueExample
 * @author:xuandian
 * @DATE: 2022/6/25 13:45
 * @description:
 */


public class MyQueExample {
    @Test
    public void testQueueAdd() throws Exception {
        MyQueue<User> users = new MyQueue();

        System.out.println(users.add(new User(1, "小王")));
        users.add(new User(2, "小黑"));
        users.add(new User(3, "小白"));
        users.add(new User(4, "小徐"));
        users.add(new User(5, "小于"));
//        users.add(new User(6,"小马"));
            assert users.size() == 5 : "失败";
    }
    @Test
    public void testQueueRemove() throws Exception {
        MyQueue<User> users = new MyQueue();
        System.out.println(users.add(new User(1, "小王")));
        users.add(new User(2, "小黑"));
        users.add(new User(3, "小白"));
        users.add(new User(4, "小徐"));
        users.add(new User(5, "小于"));
        for (int i=0;i<6;i++){
            users.poll();
            if(i==5){
                assert users.size() == 5 : "失败";
            }
        }
    }

}
